package org.solar.util;


import java.util.HashMap;
import java.util.Map;

public class ThreadLocalUtil {
    private static final ThreadLocal<Map> userThreadLocal = new ThreadLocal();
    public static void put(Object key,Object val){
        Map map=userThreadLocal.get();
        if (map==null){
            map=new HashMap();
            userThreadLocal.set(map);
        }
        map.put(key,val);
    }
    public static void remove(){
        userThreadLocal.remove();
    }
    public static <T> T get(Object key){
        Map map=userThreadLocal.get();
        if (map==null){
            return null;
        }
        return (T)map.get(key);
    }


}
